Class TLcdViewshedMultilevelRaster
- All Implemented Interfaces:
ILcdMultilevelRaster,ILcdBounded,ILcdCache
ILcdViewshed.
It typically represents visibility for an area at a fixed height above a
terrain.
![]() |
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 Summary
ConstructorsConstructorDescriptionTLcdViewshedMultilevelRaster(ILcdBounds aBounds, ILcdViewshed aViewshed, ILcdModelModelTransformation aRasterToViewshedTransformation, IndexColorModel aColorModel, ILcdBuffer aBuffer) Creates a viewshed raster with default levels of detail.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.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. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cache.Returns theILcdBoundsby which the geometry of thisILcdBoundedobject is bounded.getCachedObject(Object aKey) Looks up and returns the cached Object corresponding to the given key.Returns the height provider used by this viewshed raster.Gets the transformation from the model in which this raster resides to the cartesian reference of the containing viewshedgetRaster(int aLevel) intdoubleReturns the height above the terrain at which visibility is sampled.voidinsertIntoCache(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.removeCachedObject(Object aKey) Looks up and removes the cached Object corresponding to the given key.voidsetHeightProvider(ILcdHeightProvider aHeightProvider) Sets the height provider for this viewshed raster.voidsetTargetHeight(double aTargetHeight) Sets the height above the terrain at which visibility should be sampled.
-
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 andaColorModel.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- whenaColorModel.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 andaColorModel.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- whenaColorModel.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 andaColorModel.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- whenaColorModel.getMapSize()is larger than 256.
-
-
Method Details
-
getModelToCartesianTransformation
Gets the transformation from the model in which this raster resides to the cartesian reference of the containing viewshed- Returns:
- an
ILcdModelModelTransformation.
-
setHeightProvider
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
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:
getRasterCountin interfaceILcdMultilevelRaster- Returns:
- the number of
ILcdRasterobjects in thisILcdMultilevelRaster.
-
getRaster
- Specified by:
getRasterin interfaceILcdMultilevelRaster- Returns:
- the
ILcdRasterat level aLevel.
-
getBounds
Description copied from interface:ILcdBoundedReturns theILcdBoundsby which the geometry of thisILcdBoundedobject 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
undefinedbounds. You can create undefined bounds using the default constructors ofTLcdLonLatBoundsorTLcdXYBounds.- Specified by:
getBoundsin interfaceILcdBounded- Returns:
- the
ILcdBoundsby which the geometry of thisILcdBoundedobject is bounded.
-
insertIntoCache
Description copied from interface:ILcdCacheInserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCachein interfaceILcdCache- 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
Description copied from interface:ILcdCacheLooks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObjectin interfaceILcdCache- 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
Description copied from interface:ILcdCacheLooks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObjectin interfaceILcdCache- 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:ILcdCacheClears the cache.- Specified by:
clearCachein interfaceILcdCache
-
