Class TLcdEarthTerrainElevationProvider

java.lang.Object
com.luciad.earth.util.ALcdEarthTerrainElevationProvider
com.luciad.earth.util.TLcdEarthTerrainElevationProvider

public class TLcdEarthTerrainElevationProvider extends ALcdEarthTerrainElevationProvider
An ALcdEarthTerrainElevationProvider that can handle multiple models with elevation data.

In most cases the more recent ILcdHeightProvider and ILcdModelHeightProviderFactory interfaces should be preferred over this class. The functionality of this class is equivalent to using a TLcdEarthHeightProviderFactory and TLcdImageModelHeightProviderFactory to create a height provider for each model and combining those with a TLcdCompositeHeightProvider.

This class is optimized for the case where all models have the same model reference. If this is not the case, the elevation provider still works but will do so with reduced performance due to the need for additional transformations.

The order of the elevation model determines their relative importance for computing the result of retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference, double): the lower the index, the higher the importance. There is no particular order within a single model but this elevation provider always uses the most-detailed level in a ILcdMultilevelRaster and the most-detailed level that is available in a ILcdEarthTileSet.

This class is thread-safe.

Since:
8.2
See Also:
  • Constructor Details

    • TLcdEarthTerrainElevationProvider

      public TLcdEarthTerrainElevationProvider()
      Creates a new TLcdEarthTerrainElevationProvider with no elevation models.
    • TLcdEarthTerrainElevationProvider

      public TLcdEarthTerrainElevationProvider(Vector aElevationModels)
      Creates a new TLcdEarthTerrainElevationProvider with the specified elevation models.
      Parameters:
      aElevationModels - ILcdModel objects containing elevation data.
  • Method Details

    • isSupportedElevationModel

      public boolean isSupportedElevationModel(ILcdModel aModel)
      Returns whether a model contains elevation data that can be used.

      This elevation provider only supports models which have a proper model descriptor and contain either ILcdRaster, ILcdMultilevelRaster or ILcdEarthTileSet elements.

      Parameters:
      aModel - the model that should be tested.
      Returns:
      true if a aModel contains supported elevation data.
    • getElevationModelCount

      public int getElevationModelCount()
      Returns the number of elevation models.
      Returns:
      the number of elevation models.
    • addElevationModel

      public void addElevationModel(ILcdModel aElevationModel)
      Adds the specified elevation model at the end.
      Parameters:
      aElevationModel - the elevation model to add.
      Throws:
      IllegalArgumentException - if the specified model is not supported (see isSupportedElevationModel(com.luciad.model.ILcdModel)).
    • addElevationModel

      public void addElevationModel(int aIndex, ILcdModel aElevationModel)
      Adds the specified elevation model at the specified index.
      Parameters:
      aIndex - an index in [0,getElevationModelCount()].
      aElevationModel - the elevation model to add.
      Throws:
      IllegalArgumentException - if the specified model is not supported (see isSupportedElevationModel(com.luciad.model.ILcdModel)).
    • getElevationModel

      public ILcdModel getElevationModel(int aIndex)
      Returns the elevation model at the specified index.
      Parameters:
      aIndex - an index in [0,getElevationModelCount()[.
      Returns:
      the elevation model at the specified index.
    • removeElevationModel

      public ILcdModel removeElevationModel(int aIndex)
      Removes the elevation model at the specified index.
      Parameters:
      aIndex - an index in [0,getElevationModelCount()[.
      Returns:
      the elevation model that was removed.
    • indexOf

      public int indexOf(ILcdModel aModel)
      Returns the index of the specified elevation model or -1 if it is not present.
      Parameters:
      aModel - the elevation model.
      Returns:
      an index in [0,getElevationModelCount()[ or -1.
    • retrieveElevationAt

      public double retrieveElevationAt(ILcdPoint aPoint, ILcdGeoReference aPointReference, 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.
      aPointReference - 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.
    • 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.
    • 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 preferred reference of this elevation provider. Note that this method can return null if no preferred reference is available.
      See Also: