NASA World Wind

gov.nasa.worldwind.terrain
Class BathymetryFilterElevationModel

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.BathymetryFilterElevationModel
All Implemented Interfaces:
AVList, Disposable, MessageListener, ElevationModel, Restorable, WWObject, PropertyChangeListener, EventListener

public class BathymetryFilterElevationModel
extends AbstractElevationModel

An elevation model to map another elevation model's depths to a constant value, usually 0. It's typically used to produce flat oceans when using an elevation model containing bathymetry. This elevation model filters elevations returned from the source elevation model and sets all elevations less than a specified threshold (0 by default) to that threshold. All elevations returned by the source elevation model are filtered, including the source model's extreme elevations.


Field Summary
protected  ElevationModel sourceModel
           
protected  double threshold
           
 
Fields inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
dataFileStore, enabled, expiryTime, missingDataFlag, missingDataValue, networkRetrievalEnabled
 
Constructor Summary
BathymetryFilterElevationModel(ElevationModel source)
          Constructs an elevation model that filters the elevations from a specified elevation model.
 
Method Summary
protected  double clampElevation(double elevation)
          Called to clamp a source elevation to this elevation model's threshold.
 boolean contains(Angle latitude, Angle longitude)
          Indicates whether a specified location is within the elevation model's domain.
 void dispose()
          Disposes of any internal resources allocated by the object.
 double getBestResolution(Sector sector)
          Indicates the best resolution attainable for a specified sector.
 double getElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] buffer)
          Returns the elevations of a collection of locations.
 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.
 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 getMaxElevation()
          Returns the maximum elevation contained in the elevation model.
 double getMinElevation()
          Returns the minimum elevation contained in the elevation model.
 ElevationModel getSourceModel()
          Returns the source elevation model.
 double getThreshold()
          Returns the threshold value.
 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.
 int intersects(Sector sector)
          Indicates whether the elevation model covers a specified sector either partially or fully.
 void setThreshold(double threshold)
          Sets the value of the threshold.
 
Methods inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
composeElevations, createElevationModelConfigElements, getDataFileStore, getDetailHint, getElevation, getElevationModelConfigParams, getExpiryTime, getMissingDataReplacement, getMissingDataSignal, getName, getRestorableState, isElevationModelConfigDocument, isEnabled, isNetworkRetrievalEnabled, isTransparentValue, restoreState, setDataFileStore, setEnabled, setExpiryTime, 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, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, 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.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, 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

sourceModel

protected ElevationModel sourceModel

threshold

protected double threshold
Constructor Detail

BathymetryFilterElevationModel

public BathymetryFilterElevationModel(ElevationModel source)
Constructs an elevation model that filters the elevations from a specified elevation model.

Parameters:
source - the elevation model to filter.
Method Detail

clampElevation

protected double clampElevation(double elevation)
Called to clamp a source elevation to this elevation model's threshold.

Parameters:
elevation - the elevation to check and map.
Returns:
the input elevation if it is greater than or equal to the threshold elevation, otherwise the threshold elevation.

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.

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.

dispose

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

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractElevationModel

getBestResolution

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

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.

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.

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)

getExtremeElevations

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

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.

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.

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
Overrides:
getLocalDataAvailability in class AbstractElevationModel
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.

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.

Returns:
The maximum elevation of the elevation model.

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.)

Returns:
The minimum elevation of the model.

getSourceModel

public ElevationModel getSourceModel()
Returns the source elevation model.

Returns:
the source elevation model.

getThreshold

public double getThreshold()
Returns the threshold value.

Returns:
the threshold.

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.

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.

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.

intersects

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

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.

setThreshold

public void setThreshold(double threshold)
Sets the value of the threshold. The default threshold is 0.

Parameters:
threshold - the desired threshold. Elevations less than this value are set to this value prior to being return by any method returning one or more elevations.

NASA World Wind