Class TLcdViewHeightProvider<S extends ILcdView & ILcdLayered>

java.lang.Object
com.luciad.util.height.TLcdViewHeightProvider<S>
All Implemented Interfaces:
ILcdBounded, ILcdHeightProvider

public class TLcdViewHeightProvider<S extends ILcdView & ILcdLayered> extends Object implements ILcdHeightProvider
This ILcdHeightProvider retrieves height based on a view. It uses its layers or models to retrieve the height data. This height provider is able to update itself when a new layer is added or removed from the given view, when the visibility of a layer is changed in the given view, or when the model in one of the layers is changed.

Sample code

A class that requires a height provider based on a all raster models in a view could construct one as follows:


 // Create a height provider factory for raster models.
 ILcdModelHeightProviderFactory factory = new TLcdRasterModelHeightProviderFactory();

 // Specify the desired properties for the height provider.
 Map<String, Object> requiredProperties = new HashMap<String, Object>();
 requiredProperties.put(ILcdModelHeightProviderFactory.KEY_GEO_REFERENCE, aModelReference);

 Map<String, Object> optionalProperties = new HashMap<String, Object>();
 optionalProperties.put(ALcdRasterModelHeightProviderFactory.KEY_PIXEL_DENSITY, 2.5);

 // Create a height provider for all raster models in the view.
 ILcdHeightProvider heightProvider =
   new TLcdViewHeightProvider<ILcdGXYView>(aView,
                                           factory,
                                           requiredProperties,
                                           optionalProperties);
 

A similar approach can be used based on the layers instead of the model by creating and adding an ILcdLayerHeightProviderFactory instance instead of an ILcdModelHeightProviderFactory instance. A combination of layer and model height provider factories is not possible.

For many cases it is sufficient to add the ILcdModelHeightProviderFactory.KEY_GEO_REFERENCE property. Not setting this property will generate an exception in most cases. When using a ILcdHeightProvider constructed with a specific ILcdGeoReference as required property, one can retrieve height using ILcdPoints that are defined in this reference. For example, if the reference is a TLcdGeodeticReference, the points passed to ILcdHeightProvider.retrieveHeightAt(ILcdPoint) should be TLcdLonLatPoints. If the reference is a TLcdGridReference, the points passed to it should be TLcdXYPoints.

Other properties that can be passed are for example :

  • ALcdRasterModelHeightProviderFactory.KEY_PIXEL_DENSITY : This property determines which raster is chosen from a multi level raster, or which level is chosen from a tile set. In most cases, this property should be passed as an optional property since not all height providers factories can interpret it.
  • KEY_ONLY_VISIBLE : This property is used to denote that only visible layers should be used when creating a view height provider.

This class is thread safe, as long as the given model and layer height provider factories are thread safe, and as long as they produce ILcdHeightProvider instances that are thread safe. Note that TLcdViewHeightProvider&lt;ILcdGXYView&gt; instances should always be created on the EDT thread.

Since:
9.1
  • Field Details

    • KEY_ONLY_VISIBLE

      public static final String KEY_ONLY_VISIBLE
      Key used to denote that only visible layers are used when creating an ILcdHeightProvider. The property should be a boolean. The default is true
      See Also:
  • Constructor Details

    • TLcdViewHeightProvider

      protected TLcdViewHeightProvider(S aView, Map<String,Object> aRequiredProperties, Map<String,Object> aOptionalProperties)
      Constructs a TLcdViewHeightProvider using a given view and a list of optional or required properties. The TLcdViewHeightProvider doesn't contain an ILcdModelHeightProviderFactory or ILcdLayerHeightProviderFactory.
      Parameters:
      aView - a layered view.
      aRequiredProperties - the required properties.
      aOptionalProperties - the optional properties.
    • TLcdViewHeightProvider

      public TLcdViewHeightProvider(S aView, ILcdModelHeightProviderFactory aModelHeightProviderFactory, Map<String,Object> aRequiredProperties, Map<String,Object> aOptionalProperties)
      Constructs a TLcdViewHeightProvider using a given view, an ILcdModelHeightProviderFactory and a list of optional and required properties.
      Parameters:
      aView - a layered view.
      aModelHeightProviderFactory - an ILcdModelHeightProviderFactory.
      aRequiredProperties - the required properties.
      aOptionalProperties - the optional properties.
    • TLcdViewHeightProvider

      public TLcdViewHeightProvider(S aView, ILcdLayerHeightProviderFactory aLayerHeightProviderFactory, Map<String,Object> aRequiredProperties, Map<String,Object> aOptionalProperties)
      Constructs a TLcdViewHeightProvider using a given view, an ILcdLayerHeightProviderFactory and a list of optional and required properties.
      Parameters:
      aView - a layered view.
      aLayerHeightProviderFactory - an ILcdLayerHeightProviderFactory.
      aRequiredProperties - the required properties.
      aOptionalProperties - the optional properties.
  • Method Details

    • getModelHeightProviderFactory

      public ILcdModelHeightProviderFactory getModelHeightProviderFactory()
      Returns the ILcdModelHeightProviderFactory to be used when creating an ILcdHeightProvider.
      Returns:
      the ILcdModelHeightProviderFactory.
    • getLayerHeightProviderFactory

      public ILcdLayerHeightProviderFactory getLayerHeightProviderFactory()
      Returns the ILcdLayerHeightProviderFactory to be used when creating an ILcdHeightProvider.
      Returns:
      the ILcdLayerHeightProviderFactory
    • retrieveHeightAt

      public double retrieveHeightAt(ILcdPoint aPoint)
      Description copied from interface: ILcdHeightProvider
      Returns the height at the given point.
      Specified by:
      retrieveHeightAt in interface ILcdHeightProvider
      Parameters:
      aPoint - a 2D point, in the horizontal reference that is determined by the implementation.
      Returns:
      the elevation at the given point, in the vertical reference that is determined by the implementation. The value may also be Double.NaN, if the elevation is not known.
    • 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.