Class BasicElevationModel
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.terrain.AbstractElevationModel
-
- gov.nasa.worldwind.terrain.BasicElevationModel
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,ElevationModel,Restorable,BulkRetrievable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
LocalRasterServerElevationModel,WCSElevationModel,WMSBasicElevationModel
public class BasicElevationModel extends AbstractElevationModel implements BulkRetrievable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBasicElevationModel.DownloadPostProcessorprotected static classBasicElevationModel.ElevationsInternal class to hold collections of elevation tiles that provide elevations for a specific sector.protected static classBasicElevationModel.ElevationTileprotected static classBasicElevationModel.RequestTask
-
Field Summary
Fields Modifier and Type Field Description protected doubledetailHintprotected java.lang.StringelevationDataByteOrderprotected java.lang.StringelevationDataTypeprotected BufferWrapperextremesprotected booleanextremesCachingEnabledprotected intextremesLevelprotected MemoryCacheextremesLookupCacheprotected java.lang.ObjectfileLockprotected LevelSetlevelsprotected java.util.concurrent.ConcurrentHashMap<TileKey,BasicElevationModel.ElevationTile>levelZeroTilesprotected doublemaxElevationprotected MemoryCachememoryCacheprotected doubleminElevationprotected static intRESOURCE_ID_OGC_CAPABILITIES-
Fields inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
dataFileStore, enabled, expiryTime, missingDataFlag, missingDataValue, networkRetrievalEnabled
-
-
Constructor Summary
Constructors Constructor Description BasicElevationModel(AVList params)BasicElevationModel(java.lang.String restorableStateInXml)BasicElevationModel(org.w3c.dom.Document dom, AVList params)BasicElevationModel(org.w3c.dom.Element domElement, AVList params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTileToCache(BasicElevationModel.ElevationTile tile, BufferWrapper elevations)protected booleanareElevationsInMemory(TileKey key)protected voidcheckElevationExpiration(BasicElevationModel.ElevationTile tile)protected voidcheckElevationExpiration(java.lang.Iterable<? extends BasicElevationModel.ElevationTile> tiles)protected double[]computeExtremeElevations(Sector sector)booleancontains(Angle latitude, Angle longitude)Indicates whether a specified location is within the elevation model's domain.protected static java.nio.ByteBufferconvertImageToElevations(java.nio.ByteBuffer buffer, java.lang.String contentType)static org.w3c.dom.DocumentcreateBasicElevationModelConfigDocument(AVList params)Creates a configuration document for a BasicElevationModel described by the specified params.static org.w3c.dom.ElementcreateBasicElevationModelConfigElements(AVList params, org.w3c.dom.Element context)Appends BasicElevationModel configuration parameters as elements to the specified context.protected org.w3c.dom.DocumentcreateConfigurationDocument(AVList params)protected MemoryCachecreateMemoryCache(java.lang.String cacheName)protected BasicElevationModel.ElevationTilecreateTile(TileKey key)protected voiddetermineExtremes(double value, double[] extremes)protected voiddoGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)protected voiddoRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)protected voiddoRestoreStateForObject(RestorableSupport rs, RestorableSupport.StateObject so)protected voiddownloadElevations(Tile tile)protected voiddownloadElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)protected voiddoWriteConfigurationParams(FileStore fileStore, java.lang.String fileName, AVList params)java.nio.ByteBuffergenerateExtremeElevations(int levelNumber)static AVListgetBasicElevationModelConfigParams(org.w3c.dom.Element domElement, AVList params)Parses BasicElevationModel parameters from a specified DOM document.doublegetBestResolution(Sector sector)Indicates the best resolution attainable for a specified sector.protected AVListgetConfigurationParams(AVList params)doublegetDetailHint(Sector sector)Returns the detail hint associated with the specified sector.java.lang.StringgetElevationDataByteOrder()java.lang.StringgetElevationDataType()protected BasicElevationModel.ElevationsgetElevations(Sector requestedSector, LevelSet levelSet, int targetLevelNumber)doublegetElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer)Returns the elevations of a collection of locations.protected doublegetElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer, boolean mapMissingData)longgetEstimatedMissingDataSize(Sector sector, double resolution)Get the estimated size in bytes of the elevations not in the WorldWind file cache for the given sector and resolution.longgetEstimatedMissingDataSize(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 BufferWrappergetExtremes()protected intgetExtremesLevel()protected MemoryCachegetExtremesLookupCache()Returns the memory cache used to cache extreme elevation computations, initializing the cache if it doesn't yet exist.LevelSetgetLevels()protected java.util.Map<TileKey,BasicElevationModel.ElevationTile>getLevelZeroTiles()doublegetLocalDataAvailability(Sector requestedSector, 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.doublegetMaxElevation()Returns the maximum elevation contained in the elevation model.protected MemoryCachegetMemoryCache()doublegetMinElevation()Returns the minimum elevation contained in the elevation model.java.lang.StringgetRestorableState()Returns an XML document string describing the object's state.voidgetRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)protected LevelgetTargetLevel(Sector sector, double targetSize)protected BasicElevationModel.ElevationTilegetTileFromMemory(TileKey tileKey)doublegetUnmappedElevation(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.doublegetUnmappedElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer)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.java.lang.ObjectgetValue(java.lang.String key)Returns the value for a specified key.protected voidinitFromOGCCapabilitiesResource(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.intintersects(Sector sector)Indicates whether the elevation model covers a specified sector either partially or fully.booleanisExtremesCachingEnabled()Indicates whether extreme value caching is enabled.protected booleanisFileExpired(Tile tile, java.net.URL fileURL, FileStore fileStore)protected booleanisRetrieveResources()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 booleanisTileLocalOrAbsent(Tile tile)protected booleanloadElevations(BasicElevationModel.ElevationTile tile, java.net.URL url)voidloadExtremeElevations(java.lang.String extremesFileName)protected doublelookupElevation(Angle latitude, Angle longitude, BasicElevationModel.ElevationTile tile)protected BufferWrappermakeBilElevations(java.net.URL url)BulkRetrievalThreadmakeLocal(Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)Start a newBulkRetrievalThreadthat downloads all elevations for a given sector and resolution to a specified file store, without downloading imagery already in the file store.BulkRetrievalThreadmakeLocal(Sector sector, double resolution, BulkRetrievalListener listener)Start a newBulkRetrievalThreadthat downloads all elevations for a given sector and resolution to the current WorldWind file cache, without downloading imagery already in the cache.protected BufferWrappermakeTiffElevations(java.net.URL url)protected booleanneedsConfigurationFile(FileStore fileStore, java.lang.String fileName, AVList params, boolean removeIfExpired)protected BufferWrapperreadElevations(java.net.URL url)protected voidrequestTile(TileKey key)protected static AVListrestorableStateToParams(java.lang.String stateInXml)voidrestoreState(java.lang.String stateInXml)Restores the object's state to what is described in the specified XML document string.protected static voidrestoreStateForParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList params)protected voidretrieveElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)protected voidretrieveLocalElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)protected voidretrieveRemoteElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)protected java.lang.StringretrieveResources()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.voidsetByteOrder(java.lang.String byteOrder)voidsetDetailHint(double hint)voidsetElevationDataType(java.lang.String dataType)voidsetExpiryTime(long expiryTime)Specifies the time of the elevation models's most recent dataset update, beyond which cached data is invalid.voidsetExtremesCachingEnabled(boolean enabled)Indicates whether extreme values of sectors should be cached as they're computed.protected static voidsetFallbacks(AVList params)java.lang.ObjectsetValue(java.lang.String key, java.lang.Object value)Adds a key/value pair to the list.protected voidstartResourceRetrieval()Starts retrieving non-tile resources associated with this model in a non-rendering thread.protected voidwriteConfigurationFile(FileStore fileStore)protected voidwriteConfigurationParams(AVList params, FileStore fileStore)-
Methods inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
composeElevations, createElevationModelConfigElements, dispose, getBestResolutions, getDataFileStore, getElevation, getElevationModelConfigParams, getElevations, getExpiryTime, getMissingDataReplacement, getMissingDataSignal, getName, getUnmappedElevations, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
-
Methods inherited from interface gov.nasa.worldwind.retrieve.BulkRetrievable
getName
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
levels
protected final LevelSet levels
-
minElevation
protected final double minElevation
-
maxElevation
protected final double maxElevation
-
elevationDataType
protected java.lang.String elevationDataType
-
elevationDataByteOrder
protected java.lang.String elevationDataByteOrder
-
detailHint
protected double detailHint
-
fileLock
protected final java.lang.Object fileLock
-
levelZeroTiles
protected java.util.concurrent.ConcurrentHashMap<TileKey,BasicElevationModel.ElevationTile> levelZeroTiles
-
memoryCache
protected MemoryCache memoryCache
-
extremesLevel
protected int extremesLevel
-
extremesCachingEnabled
protected boolean extremesCachingEnabled
-
extremes
protected BufferWrapper extremes
-
extremesLookupCache
protected MemoryCache extremesLookupCache
-
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(org.w3c.dom.Document dom, AVList params)
-
BasicElevationModel
public BasicElevationModel(org.w3c.dom.Element domElement, AVList params)
-
BasicElevationModel
public BasicElevationModel(java.lang.String restorableStateInXml)
-
-
Method Detail
-
setValue
public java.lang.Object setValue(java.lang.String key, java.lang.Object value)Description copied from interface:AVListAdds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.- Specified by:
setValuein interfaceAVList- Overrides:
setValuein classAVListImpl- Parameters:
key- the attribute name. May not benull.value- the attribute value. May benull, 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.
-
getValue
public java.lang.Object getValue(java.lang.String key)
Description copied from interface:AVListReturns the value for a specified key.- Specified by:
getValuein interfaceAVList- Overrides:
getValuein classAVListImpl- Parameters:
key- the attribute name. May not benull.- Returns:
- the attribute value if one exists in the collection, otherwise
null.
-
setFallbacks
protected static void setFallbacks(AVList params)
-
getMemoryCache
protected MemoryCache getMemoryCache()
-
createMemoryCache
protected MemoryCache createMemoryCache(java.lang.String cacheName)
-
getLevels
public LevelSet getLevels()
-
getLevelZeroTiles
protected java.util.Map<TileKey,BasicElevationModel.ElevationTile> getLevelZeroTiles()
-
getExtremesLevel
protected int getExtremesLevel()
-
getExtremes
protected BufferWrapper getExtremes()
-
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:
setExpiryTimein interfaceElevationModel- Overrides:
setExpiryTimein classAbstractElevationModel- 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.
-
getMaxElevation
public double getMaxElevation()
Description copied from interface:ElevationModelReturns 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:
getMaxElevationin interfaceElevationModel- Returns:
- The maximum elevation of the elevation model.
-
getMinElevation
public double getMinElevation()
Description copied from interface:ElevationModelReturns 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:
getMinElevationin interfaceElevationModel- Returns:
- The minimum elevation of the model.
-
getBestResolution
public double getBestResolution(Sector sector)
Description copied from interface:ElevationModelIndicates the best resolution attainable for a specified sector.- Specified by:
getBestResolutionin interfaceElevationModel- 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_VALUEif the sector does not intersect the elevation model.
-
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- Overrides:
getDetailHintin classAbstractElevationModel- Parameters:
sector- the sector in question.- Returns:
- The detail hint corresponding to the specified sector.
-
setDetailHint
public void setDetailHint(double hint)
-
getElevationDataType
public java.lang.String getElevationDataType()
-
setElevationDataType
public void setElevationDataType(java.lang.String dataType)
-
getElevationDataByteOrder
public java.lang.String getElevationDataByteOrder()
-
setByteOrder
public void setByteOrder(java.lang.String byteOrder)
-
intersects
public int intersects(Sector sector)
Description copied from interface:ElevationModelIndicates whether the elevation model covers a specified sector either partially or fully.- Specified by:
intersectsin interfaceElevationModel- 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.
-
contains
public boolean contains(Angle latitude, Angle longitude)
Description copied from interface:ElevationModelIndicates whether a specified location is within the elevation model's domain.- Specified by:
containsin interfaceElevationModel- 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.
-
setExtremesCachingEnabled
public void setExtremesCachingEnabled(boolean enabled)
Description copied from interface:ElevationModelIndicates whether extreme values of sectors should be cached as they're computed. Caching should be disabled if especially many sectors are to be used when querying extreme elevations of this elevation model, such as during terrain intersection calculations. The default is for caching to be enabled. During normal operation caching enhances performance, but during terrain intersection computation it can hamper performance.- Specified by:
setExtremesCachingEnabledin interfaceElevationModel- Parameters:
enabled- true if extreme value caching should be performed.
-
isExtremesCachingEnabled
public boolean isExtremesCachingEnabled()
Description copied from interface:ElevationModelIndicates whether extreme value caching is enabled.- Specified by:
isExtremesCachingEnabledin interfaceElevationModel- Returns:
- true if extreme values caching is enabled, otherwise false.
- See Also:
ElevationModel.setExtremesCachingEnabled(boolean)
-
createTile
protected BasicElevationModel.ElevationTile createTile(TileKey key)
-
requestTile
protected void requestTile(TileKey key)
-
isFileExpired
protected boolean isFileExpired(Tile tile, java.net.URL fileURL, FileStore fileStore)
-
loadElevations
protected boolean loadElevations(BasicElevationModel.ElevationTile tile, java.net.URL url) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addTileToCache
protected void addTileToCache(BasicElevationModel.ElevationTile tile, BufferWrapper elevations)
-
areElevationsInMemory
protected boolean areElevationsInMemory(TileKey key)
-
getTileFromMemory
protected BasicElevationModel.ElevationTile getTileFromMemory(TileKey tileKey)
-
readElevations
protected BufferWrapper readElevations(java.net.URL url) throws java.lang.Exception
- Throws:
java.lang.Exception
-
makeBilElevations
protected BufferWrapper makeBilElevations(java.net.URL url) throws java.io.IOException
- Throws:
java.io.IOException
-
makeTiffElevations
protected BufferWrapper makeTiffElevations(java.net.URL url) throws java.io.IOException, java.net.URISyntaxException
- Throws:
java.io.IOExceptionjava.net.URISyntaxException
-
convertImageToElevations
protected static java.nio.ByteBuffer convertImageToElevations(java.nio.ByteBuffer buffer, java.lang.String contentType) throws java.io.IOException- Throws:
java.io.IOException
-
makeLocal
public BulkRetrievalThread makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
Start a newBulkRetrievalThreadthat downloads all elevations for a given sector and resolution to the current WorldWind 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:
makeLocalin interfaceBulkRetrievable- 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
BulkRetrievalThreadexecuting the retrieval ornullif the specified sector does not intersect the elevation model bounding sector. - Throws:
java.lang.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 newBulkRetrievalThreadthat 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:
makeLocalin interfaceBulkRetrievable- Parameters:
sector- the sector to download data for.resolution- the target resolution, provided in radians of latitude per texel.fileStore- the file store in which to place the downloaded elevations. If null the current WorldWind file cache is used.listener- an optional retrieval listener. May be null.- Returns:
- the
BulkRetrievalThreadexecuting the retrieval ornullif the specified sector does not intersect the elevation model bounding sector. - Throws:
java.lang.IllegalArgumentException- if the sector is null or the resolution is less than zero.- See Also:
BasicElevationModelBulkDownloader
-
getEstimatedMissingDataSize
public long getEstimatedMissingDataSize(Sector sector, double resolution)
Get the estimated size in bytes of the elevations not in the WorldWind file cache for the given sector and resolution.Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.
- Specified by:
getEstimatedMissingDataSizein interfaceBulkRetrievable- Parameters:
sector- the sector to estimate.resolution- the target resolution, provided in radians of latitude per texel.- Returns:
- the estimated size in bytes of the missing elevations.
- Throws:
java.lang.IllegalArgumentException- if the sector is null or the resolution is less than zero.
-
getEstimatedMissingDataSize
public long getEstimatedMissingDataSize(Sector sector, double resolution, FileStore fileStore)
Get the estimated size in bytes of the 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:
getEstimatedMissingDataSizein interfaceBulkRetrievable- Parameters:
sector- the sector to estimate.resolution- the target resolution, provided in radians of latitude per texel.fileStore- the file store to examine. If null the current WorldWind file cache is used.- Returns:
- the estimated size in bytes of the missing elevations.
- Throws:
java.lang.IllegalArgumentException- if the sector is null or the resolution is less than zero.
-
downloadElevations
protected void downloadElevations(Tile tile)
-
downloadElevations
protected void downloadElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)
-
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)
-
determineExtremes
protected void determineExtremes(double value, double[] extremes)
-
getUnmappedElevation
public double getUnmappedElevation(Angle latitude, Angle longitude)
Description copied from interface:ElevationModelReturns 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:
getUnmappedElevationin interfaceElevationModel- 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.
-
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- Overrides:
getUnmappedLocalSourceElevationin classAbstractElevationModel- 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()).
-
getElevations
public double getElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer)
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.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_VALUEif individual elevations cannot be determined for all of the locations. - See Also:
ElevationModel.setMissingDataSignal(double)
-
getUnmappedElevations
public double getUnmappedElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer)
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.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_VALUEif individual elevations cannot be determined for all of the locations. - See Also:
ElevationModel.setMissingDataSignal(double)
-
getElevations
protected double getElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] buffer, boolean mapMissingData)
-
lookupElevation
protected double lookupElevation(Angle latitude, Angle longitude, BasicElevationModel.ElevationTile tile)
-
getExtremeElevations
public double[] getExtremeElevations(Angle latitude, Angle longitude)
Description copied from interface:ElevationModelReturns the minimum and maximum elevations at a specified location.- Specified by:
getExtremeElevationsin interfaceElevationModel- Parameters:
latitude- the latitude of the location in question.longitude- the longitude of the location in question.- Returns:
- A two-element
doublearray 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:ElevationModelReturns the minimum and maximum elevations within a specified sector of the elevation model.- Specified by:
getExtremeElevationsin interfaceElevationModel- Parameters:
sector- the sector in question.- Returns:
- A two-element
doublearray 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.
-
loadExtremeElevations
public void loadExtremeElevations(java.lang.String extremesFileName)
-
computeExtremeElevations
protected double[] computeExtremeElevations(Sector sector)
-
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.
-
getElevations
protected BasicElevationModel.Elevations getElevations(Sector requestedSector, LevelSet levelSet, int targetLevelNumber)
-
checkElevationExpiration
protected void checkElevationExpiration(BasicElevationModel.ElevationTile tile)
-
checkElevationExpiration
protected void checkElevationExpiration(java.lang.Iterable<? extends BasicElevationModel.ElevationTile> tiles)
-
generateExtremeElevations
public java.nio.ByteBuffer generateExtremeElevations(int levelNumber)
-
retrieveResources
protected java.lang.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_SUCCESSFULindicates the retrieval succeeded,AVKey.RETRIEVAL_STATE_ERRORindicates the retrieval failed with errors, andnullindicates 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_SUCCESSFULif the retrieval succeeded,AVKey.RETRIEVAL_STATE_ERRORif the retrieval failed with errors, andnullif the retrieval state is unknown.
-
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 inSwingUtilities.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:
java.lang.IllegalArgumentException- if either the Capabilities or the parameter list is null.
-
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:
trueif this ElevationModel should retrieve any non-tile resources, andfalseotherwise.
-
startResourceRetrieval
protected void startResourceRetrieval()
Starts retrieving non-tile resources associated with this model in a non-rendering thread.
-
createBasicElevationModelConfigDocument
public static org.w3c.dom.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 toBasicElevationModel.- Parameters:
params- parameters describing a BasicElevationModel.- Returns:
- a configuration document for the BasicElevationModel.
-
createBasicElevationModelConfigElements
public static org.w3c.dom.Element createBasicElevationModelConfigElements(AVList params, org.w3c.dom.Element context)
Appends BasicElevationModel configuration parameters as elements to the specified context. This appends elements for the following parameters:
This also writes common elevation model and LevelSet configuration parameters by invokingParameters Parameter Element Path Type AVKey.SERVICE_NAMEService/@serviceName String AVKey.IMAGE_FORMATImageFormat String AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormat String array AVKey.DATA_TYPEDataType/@type String AVKey.BYTE_ORDERByteOrder DataType/@byteOrder AVKey.ELEVATION_EXTREMES_FILEExtremeElevations/FileName String AVKey.ELEVATION_MAXExtremeElevations/@max Double AVKey.ELEVATION_MINExtremeElevations/@min Double AbstractElevationModel.createElevationModelConfigElements(gov.nasa.worldwind.avlist.AVList, org.w3c.dom.Element)andDataConfigurationUtils.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:
java.lang.IllegalArgumentException- if either the parameters or the context are null.
-
getBasicElevationModelConfigParams
public static AVList getBasicElevationModelConfigParams(org.w3c.dom.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:
This also parses common elevation model and LevelSet configuration parameters by invokingParameters Parameter Element Path Type AVKey.SERVICE_NAMEService/@serviceName String AVKey.IMAGE_FORMATImageFormat String AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormat String array AVKey.DATA_TYPEDataType/@type String AVKey.BYTE_ORDERDataType/@byteOrder String AVKey.ELEVATION_EXTREMES_FILEExtremeElevations/FileName String AVKey.ELEVATION_MAXExtremeElevations/@max Double AVKey.ELEVATION_MINExtremeElevations/@min Double AbstractElevationModel.getElevationModelConfigParams(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList)andDataConfigurationUtils.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:
java.lang.IllegalArgumentException- if the document is null.
-
writeConfigurationFile
protected void writeConfigurationFile(FileStore fileStore)
-
writeConfigurationParams
protected void writeConfigurationParams(AVList params, FileStore fileStore)
-
doWriteConfigurationParams
protected void doWriteConfigurationParams(FileStore fileStore, java.lang.String fileName, AVList params)
-
needsConfigurationFile
protected boolean needsConfigurationFile(FileStore fileStore, java.lang.String fileName, AVList params, boolean removeIfExpired)
-
createConfigurationDocument
protected org.w3c.dom.Document createConfigurationDocument(AVList params)
-
getRestorableState
public java.lang.String getRestorableState()
Description copied from interface: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- Overrides:
getRestorableStatein classAbstractElevationModel- 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- Overrides:
restoreStatein classAbstractElevationModel- Parameters:
stateInXml- an XML document string describing an object's state.
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
-
getRestorableStateForAVPair
public void getRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)- Overrides:
getRestorableStateForAVPairin classAVListImpl
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
-
doRestoreStateForObject
protected void doRestoreStateForObject(RestorableSupport rs, RestorableSupport.StateObject so)
-
restorableStateToParams
protected static AVList restorableStateToParams(java.lang.String stateInXml)
-
restoreStateForParams
protected static void restoreStateForParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList params)
-
getLocalDataAvailability
public double getLocalDataAvailability(Sector requestedSector, 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- Overrides:
getLocalDataAvailabilityin classAbstractElevationModel- 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.
-
isTileLocalOrAbsent
protected boolean isTileLocalOrAbsent(Tile tile)
-
-