Class TLcdViewshedMultilevelRaster

java.lang.Object
com.luciad.tea.viewshed.TLcdViewshedMultilevelRaster
All Implemented Interfaces:
ILcdMultilevelRaster, ILcdBounded, ILcdCache

public class TLcdViewshedMultilevelRaster extends Object implements ILcdMultilevelRaster
This ILcdMultilevelRaster can be used to visualize an ILcdViewshed. It typically represents visibility for an area at a fixed height above a terrain.

This raster samples the viewshed at a specified target height above the height of a height provider.
Sampling a viewshed

The above figure illustrates how the raster samples the given viewshed within given bounds, at a given height above a terrain. The terrain is represented by an optional height provider (see setHeightProvider(ILcdHeightProvider). The height is a simple constant that is added (see setTargetHeight(double)):

The raster samples the viewshed at a given number of levels of detail. Each level of detail has a tile at an increasing resolution. The maximum tile size can be specified in pixels or by means of a step size expressed in raster coordinates (viewshed coordinates). The contents of the tiles are computed on the fly and cached in a given buffer.

Since this class implements ILcdMultilevelRaster, it can be painted with a traditional multilevel raster painter like TLcdMultilevelRasterPainter.

Since:
11.0
  • Constructor Details

    • TLcdViewshedMultilevelRaster

      public TLcdViewshedMultilevelRaster(ILcdBounds aBounds, ILcdViewshed aViewshed, ILcdModelModelTransformation aRasterToViewshedTransformation, IndexColorModel aColorModel, ILcdBuffer aBuffer)
      Creates a viewshed raster with default levels of detail. This means 5 levels of detail, a level scale factor of 4, a most detailed tile size of 32768x32768 pixels, and a sub-tile size of 128x128 pixels.
      Parameters:
      aBounds - The bounds of this raster, expressed in its own raster reference.
      aViewshed - The viewshed to visualize as a raster.
      aRasterToViewshedTransformation - The transformation raster reference to the reference of the contained viewshed.
      aColorModel - The color model of this raster. The size of the specified color map should not exceed 256. Visibility values are converted to values between 0 and aColorModel.getMapSize()-1, from completely invisible to fully visible. The color map can be null. If it is null, it is up to the painter to correctly visualize the raster.
      aBuffer - The buffer in which viewshed rasters can be cached, for example: TLcdSharedBuffer.getBufferInstance().
      Throws:
      IllegalArgumentException - when aColorModel.getMapSize() is larger than 256.
    • TLcdViewshedMultilevelRaster

      public TLcdViewshedMultilevelRaster(ILcdBounds aBounds, ILcdViewshed aViewshed, ILcdModelModelTransformation aRasterToViewshedTransformation, IndexColorModel aColorModel, ILcdBuffer aBuffer, int aLevelCount, int aLevelScaleFactor, double aStepSize)
      Creates a viewshed raster sampled at the given sampling rate. The sub-tile size is 128x128 pixels.
      Parameters:
      aBounds - The bounds of this raster, expressed in its own raster reference.
      aViewshed - The viewshed to visualize as a raster.
      aRasterToViewshedTransformation - The transformation raster reference to the reference of the contained viewshed.
      aColorModel - The color model of this raster. The size of the specified color map should not exceed 256. Visibility values are converted to values between 0 and aColorModel.getMapSize()-1, from completely invisible to fully visible. The color map can be null. If it is null, it is up to the painter to correctly visualize the raster.
      aBuffer - The buffer in which viewshed rasters can be cached, for example: TLcdSharedBuffer.getBufferInstance().
      aStepSize - The sample distance of the most detailed raster level, expressed in raster coordinates (viewshed coordinate).
      Throws:
      IllegalArgumentException - when aColorModel.getMapSize() is larger than 256.
    • TLcdViewshedMultilevelRaster

      public TLcdViewshedMultilevelRaster(ILcdBounds aBounds, ILcdViewshed aViewshed, ILcdModelModelTransformation aRasterToViewshedTransformation, IndexColorModel aColorModel, ILcdBuffer aBuffer, int aLevelCount, int aLevelScaleFactor, int aTileWidth, int aTileHeight, int aSubtileWidth, int aSubtileHeight)
      Creates a viewshed raster with the given parameters.
      Parameters:
      aBounds - The bounds of this raster, expressed in its own raster reference.
      aViewshed - The viewshed to visualize as a raster.
      aRasterToViewshedTransformation - The transformation raster reference to the reference of the contained viewshed.
      aColorModel - The color model of this raster. The size of the specified color map should not exceed 256. Visibility values are converted to values between 0 and aColorModel.getMapSize()-1, from completely invisible to fully visible. The color map can be null. If it is null, it is up to the painter to correctly visualize the raster.
      aBuffer - The buffer in which viewshed rasters can be cached, for example: TLcdSharedBuffer.getBufferInstance().
      aLevelCount - The number of levels to be created.
      aLevelScaleFactor - The scale factor on both axes between subsequent levels.
      aTileWidth - The tile width of the most detailed tile, expressed in pixels.
      aTileHeight - The tile height of the most detailed tile, expressed in pixels.
      aSubtileWidth - The subtile width of the tiles, expressed in pixels.
      aSubtileHeight - The subtile height of the tiles, expressed in pixels.
      Throws:
      IllegalArgumentException - when aColorModel.getMapSize() is larger than 256.
  • Method Details

    • getModelToCartesianTransformation

      public ILcdModelModelTransformation getModelToCartesianTransformation()
      Gets the transformation from the model in which this raster resides to the cartesian reference of the containing viewshed
      Returns:
      an ILcdModelModelTransformation.
    • setHeightProvider

      public void setHeightProvider(ILcdHeightProvider aHeightProvider)
      Sets the height provider for this viewshed raster. The viewshed raster will sample the viewshed at the heights given by the height provider. The default is null, meaning that all heights are 0.
      Parameters:
      aHeightProvider - a height provider, or null if no height provider is needed.
      See Also:
    • getHeightProvider

      public ILcdHeightProvider getHeightProvider()
      Returns the height provider used by this viewshed raster.
      Returns:
      a height provider, or null if no height provider was set.
      See Also:
    • setTargetHeight

      public void setTargetHeight(double aTargetHeight)
      Sets the height above the terrain at which visibility should be sampled. The default is 0.
    • getTargetHeight

      public double getTargetHeight()
      Returns the height above the terrain at which visibility is sampled.
    • getRasterCount

      public int getRasterCount()
      Specified by:
      getRasterCount in interface ILcdMultilevelRaster
      Returns:
      the number of ILcdRaster objects in this ILcdMultilevelRaster.
    • getRaster

      public ILcdRaster getRaster(int aLevel)
      Specified by:
      getRaster in interface ILcdMultilevelRaster
      Returns:
      the ILcdRaster at level aLevel.
    • 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.
    • insertIntoCache

      public void insertIntoCache(Object aKey, Object aObject)
      Description copied from interface: ILcdCache
      Inserts a cache Object corresponding to the given key Object.
      Specified by:
      insertIntoCache in interface ILcdCache
      Parameters:
      aKey - the key Object that will be used to identify the Object. The key must therefore be a unique identifier, typically the caller itself: insertIntoCache(this, ...).
      aObject - the Object to be cached.
    • getCachedObject

      public Object getCachedObject(Object aKey)
      Description copied from interface: ILcdCache
      Looks up and returns the cached Object corresponding to the given key.
      Specified by:
      getCachedObject in interface ILcdCache
      Parameters:
      aKey - the key Object that was used for storing the cache Object.
      Returns:
      the cached Object, or null if there is no Object corresponding to the given key.
    • removeCachedObject

      public Object removeCachedObject(Object aKey)
      Description copied from interface: ILcdCache
      Looks up and removes the cached Object corresponding to the given key.
      Specified by:
      removeCachedObject in interface ILcdCache
      Parameters:
      aKey - the key Object that was used for storing the cache Object.
      Returns:
      the cached Object, or null if there was no Object corresponding to the given key.
    • clearCache

      public void clearCache()
      Description copied from interface: ILcdCache
      Clears the cache.
      Specified by:
      clearCache in interface ILcdCache