Class TLcdWCSProxy

java.lang.Object
com.luciad.datamodel.TLcdDataObject
com.luciad.ogc.wcs.client.TLcdWCSProxy
All Implemented Interfaces:
ILcdDataObject, ILcdMultilevelRaster, ILcdBounded, ILcdCache, ILcdCloneable, ILcdDeepCloneable, Cloneable

public class TLcdWCSProxy extends TLcdDataObject implements ILcdMultilevelRaster
A client for OpenGIS Web Coverage Services (WCS). This class is an ILcdMultilevelRaster, which fetches its data on the fly from a WCS which is specified at construction time.

The bounds, resolution, tiling and multileveling of the raster can be configured by the user at any time. Note, however, that changing any of these parameters invalidates all data in the raster. By default, sensible values for the tiled multilevel raster structure are determined based on the WCS coverage bounds.

TLcdWCSProxy cannot be instantiated directly. Use TLcdWCSProxyModelFactory to create WCS proxy models.

If the setAsynchronousUpdates(boolean) property is true, TLcdWCSProxy will perform requests to the WCS server on a separate thread. This will in turn result in incremental updates of the view when the proxy is painted, which improves the responsiveness of the application. Note, however, that the property TLcdMultilevelRasterPainter.setUseDeferredSubTileDecoding(boolean) is best switched off in this case. If it is on, the raster painter may defer the view update a second time, increasing the delay with which the coverage data is actually shown.

This class also implements the imaging API using a has-an-image paradigm. It is a TLcdDataObject of a TLcdDataType that has a TLcdHasGeometryAnnotation. You can get the ALcdImage object using ALcdImage.fromDomainObject(Object) where you pass an instance of this class as argument.

Because an ALcdImage represents read-only data, a new such object is created whenever a relevant configuration parameter changes. For example, when you set a different bounds on this proxy, a new ALcdImage will be created. You have to get the ALcdImage again using ALcdImage.fromDomainObject(Object) in order to get the updated image. References to outdated ALcdImages are still valid, but they will be outdated.

When using the imaging API, behavior is always synchronous and the configuration parameter setAsynchronousUpdates(boolean) is ignored.

See Also:
  • Method Details

    • invalidate

      public void invalidate()
      Marks the raster as invalid, which will cause it to be reconstructed the next time it is accessed.
    • getCoverageOffering

      public TLcdWCSCoverageOffering getCoverageOffering()
      Returns a TLcdWCSCoverageOffering describing the requested coverage.
      Returns:
      a TLcdWCSCoverageOffering describing the requested coverage.
    • getCoverageBounds

      public ILcdBounds getCoverageBounds()
      Returns the 2D bounds of the available area for the requested coverage.
      Returns:
      the 2D bounds of the available area for the requested coverage.
    • getBounds

      public ILcdBounds getBounds()
      Returns the 2D bounds of the area that is currently retrieved for the requested coverage.
      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      the 2D bounds of the area that is currently retrieved for the requested coverage.
    • 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
    • getRasterCount

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

      public ILcdRaster getRaster(int aIndex)
      Specified by:
      getRaster in interface ILcdMultilevelRaster
      Returns:
      the ILcdRaster at level aLevel.
    • setTileRowCount

      public void setTileRowCount(int aTileRowCount)
      Sets the number of tile rows that should be created for the most detailed raster. Lower-level rasters may be given fewer tiles.
      Parameters:
      aTileRowCount - the tile row count
      Throws:
      IllegalArgumentException - if the given tile row count is negative or zero.
    • setTileColumnCount

      public void setTileColumnCount(int aTileColumnCount)
      Sets the number of tile columns that should be created for the most detailed raster. Lower-level rasters may be given fewer tiles.
      Parameters:
      aTileColumnCount - the tile column count
      Throws:
      IllegalArgumentException - if the given tile column count is negative or zero.
    • setTilePixelWidth

      public void setTilePixelWidth(int aTilePixelWidth)
      Sets the width of each single raster tile in pixels. If the tile resolution is specified, the tile width and height are ignored.
      Parameters:
      aTilePixelWidth - the new tile width
      Throws:
      IllegalArgumentException - if the given tile pixel width is negative or zero.
      See Also:
    • setTilePixelHeight

      public void setTilePixelHeight(int aTilePixelHeight)
      Sets the height of each single raster tile in pixels. If the tile resolution is specified, the tile width and height are ignored.
      Parameters:
      aTilePixelHeight - the new tile height
      Throws:
      IllegalArgumentException - if the given tile pixel height is negative or zero.
      See Also:
    • setResolution

      public void setResolution(double aResX, double aResY)
      Set the resolution of each single raster tile. If the tile resolution is specified, the tile width and height are ignored.
      Parameters:
      aResX - resolution on the X-axis
      aResY - resolution on the Y-axis
      Throws:
      IllegalArgumentException - if one of the resolution is negative or zero.
      See Also:
    • setBounds

      public void setBounds(ILcdBounds aBounds)
      Sets the 2D bounds of the area that should be retrieved. The bounds should be expressed in the reference of the enclosing proxy model. If null is supplied as bounds, the request bounds are reset to the coverage bounds (see getCoverageBounds().

      By default, the bounds are equal to the coverage bounds.

      Parameters:
      aBounds - the request bounds
    • setBounds

      public void setBounds(ILcdBounds aBounds, ILcdGeoReference aBoundsReference)
      Sets the 2D bounds of the area that should be retrieved. The bounds should be expressed in the supplied reference. A best effort will be made to perform the coverage request using the given reference. If null is supplied as bounds, the request bounds are reset to the coverage bounds (see getCoverageBounds().

      By default, the bounds are equal to the coverage bounds.

      Parameters:
      aBounds - the request bounds
      aBoundsReference - the reference of the request bounds
    • setBoundsType

      public void setBoundsType(TLcdWCSProxy.BoundsType aBoundsType)
      Sets the interpretation of the request bounds (see setBounds(com.luciad.shape.ILcdBounds) and setBounds(com.luciad.shape.ILcdBounds, com.luciad.reference.ILcdGeoReference)).

      By default, the bounds type is TLcdWCSProxy.BoundsType.BOUNDS_2D, indicating that the request bounds are interpreted as 2-dimensional bounds.

      Parameters:
      aBoundsType - The interpretation of the request bounds
      Throws:
      NullPointerException - if the bounds type is null
    • setRasterCount

      public void setRasterCount(int aLevelCount)
      Sets the number of levels in the raster. The highest level raster will have the resolution specified by the user. Lower raster levels will be constructed by decreasing the number of tiles and/or the resolution of the tiles.
      Parameters:
      aLevelCount - the desired number of raster levels
      Throws:
      IllegalArgumentException - if the given level count is negative or zero.
    • setTimeInstants

      public void setTimeInstants(String[] aTimes)
      Sets one or more time instants to request a subset of the specified coverage. The time instants must be expressed in an (extended) ISO 8601 syntax.
      Parameters:
      aTimes - time instants to request a subset of a coverage
    • setTimeIntervals

      public void setTimeIntervals(String[][] aTimeIntervals)
      Sets one or more time intervals to request a subset of the specified coverage. The time instants must be expressed in an (extended) ISO 8601 syntax.
      Parameters:
      aTimeIntervals - time intervals to request a subset of a coverage
    • setInterpolationMethod

      public void setInterpolationMethod(TLcdWCSInterpolationMethod aInterpolationMethod)
      Sets the interpolation method with which the coverage should be approximated.
      Parameters:
      aInterpolationMethod - the interpolation method
    • getInterpolationMethod

      public TLcdWCSInterpolationMethod getInterpolationMethod()
      Return the interpolation method with which the coverage is approximated.
      Returns:
      the interpolation method
    • setPlaceholderImage

      public void setPlaceholderImage(BufferedImage aPlaceholderImage)
      Sets the image that is displayed while a WCS tile is being loaded. By default these tiles are displayed transparent gray.
      Parameters:
      aPlaceholderImage - the placeholder image
    • setErrorImage

      public void setErrorImage(BufferedImage aErrorImage)
      Sets the image that is displayed when a WCS tile could not be retrieved due to an error. By default these tiles are displayed transparently
      Parameters:
      aErrorImage - the error image
    • setExceptionHandler

      public void setExceptionHandler(ILcdExceptionHandler aExceptionHandler)
      Sets an exception handler to use when exceptions occur while connecting to the WCS. Exceptions may include service exceptions from the WCS itself, but also client-side exceptions that may occur if the response of the WCS cannot be properly decoded. If the exception handler is not set (or set to null), any exceptions will be silently ignored.
      Parameters:
      aExceptionHandler - an exception handler
    • getTimeInstants

      public String[] getTimeInstants()
      Returns the time instants used to request a subset of the specified coverage.
      Returns:
      the time instants used to request a subset of the specified coverage.
      See Also:
    • getTimeIntervals

      public String[][] getTimeIntervals()
      Returns the time intervals used to request a subset of the specified coverage.
      Returns:
      the time intervals used to request a subset of the specified coverage.
      See Also:
    • getExceptionHandler

      public ILcdExceptionHandler getExceptionHandler()
      Returns the current exception handler.
      Returns:
      the current exception handler.
    • setAsynchronousUpdates

      public void setAsynchronousUpdates(boolean aAsynchronousUpdates)
      Specifies whether or not the WCS proxy should retrieve data asynchronously. If this property is set to true (the default value), the proxy will spread WCS requests out over multiple threads, allowing them to be processed simultaneously. Model changed events will be fired to notify the application when a tile in the raster has obtained all its data from the WCS.

      If this property is set to false, all updates to the WCS proxy will be performed synchronously on the calling thread.

      Parameters:
      aAsynchronousUpdates - true if asynchronous updating should be used
    • isAsynchronousUpdates

      public boolean isAsynchronousUpdates()
      Returns true if asynchronous updating is enabled.
      Returns:
      true if asynchronous updating is enabled
      See Also:
    • getTileRowCount

      public int getTileRowCount()
      Return the number of tile rows in the most detailed raster. Lower-level rasters may be given fewer tiles.
      Returns:
      the number of tile rows in the most detailed raster
      See Also:
    • getTileColumnCount

      public int getTileColumnCount()
      Return the number of tile columns in the most detailed raster. Lower-level rasters may be given fewer tiles.
      Returns:
      the number of tile columns in the most detailed raster
      See Also:
    • getTilePixelWidth

      public int getTilePixelWidth()
      Returns the width of a single raster tile in pixels.
      Returns:
      the width of a single raster tile in pixels
    • getTilePixelHeight

      public int getTilePixelHeight()
      Returns the height of a single raster tile in pixels.
      Returns:
      the height of a single raster tile in pixels