Class TLcdEarthTileSetElevationProvider

java.lang.Object
com.luciad.earth.util.ALcdEarthTerrainElevationProvider
com.luciad.earth.tileset.terrain.TLcdEarthTileSetElevationProvider
All Implemented Interfaces:
ILcdBounded

public class TLcdEarthTileSetElevationProvider extends ALcdEarthTerrainElevationProvider implements ILcdBounded
An elevation provider that gets its elevation data from a tileset.

This class is thread-safe for reading if the elevation tileset is thread-safe for tile reading.

Since:
8.2
  • Constructor Details

    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet)
      Creates a new elevation provider that does not scale the provided elevations and requests all tiles synchronously. It is assumed that the reference of the tileset is a geodetic reference.
      Parameters:
      aElevationTileSet - The elevation tileset.
      Throws:
      IllegalArgumentException - If the given tileset does not have a valid elevation coverage.
      See Also:
    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet, ILcdGeoReference aTileSetReference)
      Creates a new elevation provider that does not scale the provided elevations and requests all tiles synchronously.
      Parameters:
      aElevationTileSet - The elevation tileset.
      aTileSetReference - The reference in which the tile set's bounds and tile pyramid are defined
      Throws:
      IllegalArgumentException - If the given tileset does not have a valid elevation coverage.
      See Also:
    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet, ILcdEarthTileSetCoverage aElevationCoverage, ILcdGeoReference aTileSetReference)
      Creates a new elevation provider that does not scale the provided elevations and requests all tiles synchronously.
      Parameters:
      aElevationTileSet - The elevation tileset.
      aElevationCoverage - The coverage in the elevation tileset that contains the elevation data.
      aTileSetReference - The reference in which the tileset's bounds and tile pyramid are defined
      Throws:
      IllegalArgumentException - If the given tileset does not have a valid elevation coverage.
      See Also:
    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet, double aElevationScale, double aElevationOffset, int aCacheSize)
      Creates a new elevation provider that scales the provided elevations and requests all tiles synchronously. It is assumed that the reference of the tileset is a geodetic reference.
      Parameters:
      aElevationTileSet - The elevation tileset.
      aElevationScale - The scale to apply to the elevation data.
      aElevationOffset - The offset to apply to the elevation data.
      aCacheSize - The number of tiles that are cached.
      Throws:
      IllegalArgumentException - If the given tileset does not have a valid elevation coverage.
      See Also:
    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet, double aElevationScale, double aElevationOffset, int aCacheSize, ILcdGeoReference aTileSetReference)
      Creates a new elevation provider that scales the provided elevations and requests all tiles synchronously.
      Parameters:
      aElevationTileSet - The elevation tileset.
      aElevationScale - The scale to apply to the elevation data.
      aElevationOffset - The offset to apply to the elevation data.
      aCacheSize - The number of tiles that are cached.
      aTileSetReference - The reference in which the tile set's bounds and tile pyramid are defined
      Throws:
      IllegalArgumentException - If the given tileset does not have a valid elevation coverage.
      See Also:
    • TLcdEarthTileSetElevationProvider

      public TLcdEarthTileSetElevationProvider(ILcdEarthTileSet aElevationTileSet, ILcdEarthTileSetCoverage aElevationCoverage, double aElevationScale, double aElevationOffset, int aCacheSize, ILcdGeoReference aTileSetReference)
      Creates a new elevation provider that scales the provided elevations and requests all tiles synchronously.
      Parameters:
      aElevationTileSet - The elevation tileset.
      aElevationCoverage - The coverage in the elevation tileset that contains the elevation data.
      aElevationScale - The scale to apply to the elevation data.
      aElevationOffset - The offset to apply to the elevation data.
      aCacheSize - The number of tiles that are cached.
      aTileSetReference - The reference in which the tile set's bounds and tile pyramid are defined
      Throws:
      IllegalArgumentException - If the given tileset coverage does not contains an elevation coverage.
      See Also:
  • Method Details

    • isElevationTileSet

      public static boolean isElevationTileSet(ILcdEarthTileSet aTileSet)
      Returns whether the specified tileset is an elevation tileset. If this method returns true the tileset contains an elevation coverage.
      Parameters:
      aTileSet - the tileset to test.
      Returns:
      true if the specified tileset is an elevation tileset.
      See Also:
    • isElevationCoverage

      public static boolean isElevationCoverage(ILcdEarthTileSet aTileSet, ILcdEarthTileSetCoverage aCoverage)
      Returns whether the coverage in the specified coverage contains elevation data.
      Parameters:
      aTileSet - the tileset
      aCoverage - the coverage in aTileSet
      Returns:
      true if aCoverage contains elevation data.
    • getElevationTileSet

      public ILcdEarthTileSet getElevationTileSet()
      Returns the tileset that contains the elevation data.
      Returns:
      the elevation tileset.
    • getElevationCoverage

      public ILcdEarthTileSetCoverage getElevationCoverage()
      Returns the coverage in the elevation tileset that contains the elevation data.
      Returns:
      the elevation coverage.
    • getMaxTileLevel

      public int getMaxTileLevel()
      Returns that maximum level at which tiles are retrieved. Using a higher maximum level generally results in more accurate elevation values but reduces the performance due to a smaller cache hit rate (tiles at higher levels are smaller so the chance that two points are in the same tile reduces).
      Returns:
      The maximum level at which tiles are retrieved.
    • setMaxTileLevel

      public void setMaxTileLevel(int aMaxLevel)
      Sets the maximum tile level to the given value.
      Parameters:
      aMaxLevel - The new maximum level.
      Throws:
      IllegalArgumentException - if aMaxLevel is negative or greater than the maximum level of the elevation tileset.
      See Also:
    • isForceAsynchronousTileRequests

      public boolean isForceAsynchronousTileRequests()
      Returns whether all tile requests are be forced to happen asynchronously.

      Note that if forcing asynchronous tile requests is enabled, all tile requests will happen asynchronously, regardless of the value of getMaxSynchronousLevel().

      In general this setting should be enabled if the callers of the retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference) methods should never block (ex. for IO). This is for example the case if the elevations are retrieved from the Event Dispatch Thread.

      Returns:
      true if all tile requests are be forced to happen asynchronously, false if synchronous tile requests are allowed.
      See Also:
    • setForceAsynchronousTileRequests

      public void setForceAsynchronousTileRequests(boolean aForceAsynchronous)
      Sets whether all tile requests should be forced to happen asynchronously.
      Parameters:
      aForceAsynchronous - true if all tile requests should happen asynchronously, false if synchronous tile requests are allowed.
      See Also:
    • getMaxSynchronousLevel

      public int getMaxSynchronousLevel()
      Returns the maximum level at which tiles will be requested synchronously. All data at higher levels will be requested asynchronously. So tiles can be requested asynchronously if the maximum synchronous level is smaller than the maximum tile level. Requesting tiles asynchronously improves the performance of the retrieve altitude methods but, because some tiles may or may not immediately be available, the returned altitudes can vary over time.

      Note that this settings can be overridden by isForceAsynchronousTileRequests(),

      Returns:
      The maximum level at which tiles are retrieved synchronously.
      See Also:
    • setMaxSynchronousLevel

      public void setMaxSynchronousLevel(int aMaxSynchronousLevel)
      Sets the maximum level at which tiles are requested synchronously.
      Parameters:
      aMaxSynchronousLevel - The maximum level at which tiles are requested synchronously or -1 to always request tiles synchronously.
      Throws:
      IllegalArgumentException - if the aMaxSynchronousLevelis smaller than -1 or greater than the maximum level of the elevation tileset.
      See Also:
    • getElevationScale

      public double getElevationScale()
      Returns:
      The current elevation scale.
    • setElevationScale

      public void setElevationScale(double aScale)
      Sets the elevation scale to the given value.
      Parameters:
      aScale - The new elevation scale.
    • getElevationOffset

      public double getElevationOffset()
      Returns:
      The current elevation offset.
    • setElevationOffset

      public void setElevationOffset(double aOffset)
      Sets the elevation offset to the given value.
      Parameters:
      aOffset - The new elevation offset.
    • getCacheSize

      public int getCacheSize()
      Returns the maximum number of tiles that are cached.
      Returns:
      the maximum number of tiles that are cached.
    • setCacheSize

      public void setCacheSize(int aSize)
      Sets the maximum number of tiles that should be cached.
      Parameters:
      aSize - the maximum number of tiles that should be cached.
      Throws:
      IllegalArgumentException - if aSize is negative.
    • clearCache

      public void clearCache()
      Clears the tile cache.
    • getExceptionHandler

      public ILcdExceptionHandler getExceptionHandler()
      Returns the exception handler that is used to handle exceptions that occur during tile retrieval. The default exception handler simply writes a log entry.
      Returns:
      the exception handler
    • setExceptionHandler

      public void setExceptionHandler(ILcdExceptionHandler aExceptionHandler)
      Sets the exception handler that is used to handle exceptions that occur during tile retrieval.
      Parameters:
      aExceptionHandler - the exception handler
    • isInterpolateData

      public boolean isInterpolateData()
      Returns whether the elevation data is interpolated or not.
      Returns:
      true if the elevation data is interpolated
    • setInterpolateData

      public void setInterpolateData(boolean aInterpolateData)
      Returns whether the elevation data should be interpolated or not.

      The default value is true.

      Parameters:
      aInterpolateData - true if the elevation data should be interpolated
    • retrieveElevationAt

      public double retrieveElevationAt(ILcdPoint aPoint, ILcdGeoReference aGeoReference)
      Description copied from class: ALcdEarthTerrainElevationProvider
      Returns the elevation for a given location, defined in meters above mean sea level. If the elevation cannot be determined, this method returns NaN.
      Specified by:
      retrieveElevationAt in class ALcdEarthTerrainElevationProvider
      Parameters:
      aPoint - The point indicating the location for which to retrieve the elevation.
      aGeoReference - The reference in which the given location is defined.
      Returns:
      the elevation for a given location, defined in meters above mean sea level, or NaN when the elevation cannot be determined.
    • retrieveElevationAt

      public double retrieveElevationAt(ILcdPoint aPoint, ILcdGeoReference aGeoReference, double aDesiredResolution)
      Description copied from class: ALcdEarthTerrainElevationProvider
      Returns the elevation for a given location, defined in meters above mean sea level. If the elevation cannot be determined, this method returns NaN. The aDesiredResolution parameter can be used to indicate to the elevation provider what the desired resolution of the elevation values should be. The value should be a distance measured in units of the point reference. If an application wants to request elevations for a grid of points which are 10 units apart, for instance, it could pass a value of 10.0 in aDesiredResolution. The elevation provider could then optimize for this particular resolution, e.g. by choosing the appropriate detail level from a multileveled elevation raster.

      The default implementation of this method simply delegates to ALcdEarthTerrainElevationProvider.retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference) and hence does not use the aDesiredResolution parameter.

      Overrides:
      retrieveElevationAt in class ALcdEarthTerrainElevationProvider
      Parameters:
      aPoint - The point indicating the location for which to retrieve the elevation.
      aGeoReference - The reference in which the given location is defined.
      aDesiredResolution - An indication of the spacing (in units of the point reference) between sample points for which elevations are being retrieved
      Returns:
      the elevation for a given location, defined in meters above mean sea level, or NaN when the elevation cannot be determined.
    • getBounds

      public ILcdBounds getBounds()
      Description copied from interface: ILcdBounded
      Returns the ILcdBounds by which the geometry of this ILcdBounded object is bounded.

      If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points) the return value is unspecified. It is highly recommended to return an undefined bounds. You can create undefined bounds using the default constructors of TLcdLonLatBounds or TLcdXYBounds.

      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      the ILcdBounds by which the geometry of this ILcdBounded object is bounded.
    • getPreferredReference

      public ILcdGeoReference getPreferredReference()
      Description copied from class: ALcdEarthTerrainElevationProvider

      Returns the preferred reference for this elevation provider. This reference is the reference with the best performance when used as a parameter in the method ALcdEarthTerrainElevationProvider.retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference). It is perfectly correct to use points with other references. It will be faster to use the preferred one.

      For performance reasons, the preferred reference should be the reference of the available elevation data to minimize the number of point transformations.

      By default this method returns null, indicating that no preferred reference is available.

      Overrides:
      getPreferredReference in class ALcdEarthTerrainElevationProvider
      Returns:
      the reference of the tile set.
      See Also: